﻿using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class BuildSettingsConfigurator : MonoBehaviour
{
    [MenuItem("Tools/Set Build Settings")]
    public static void SetBuildSettings()
    {
        // 设置 Product Name
        PlayerSettings.productName = "MyAwesomeApp";

        // 设置应用程序图标
        string iconPath = "Assets/Icons/icon.png";
        Texture2D iconTexture = AssetDatabase.LoadAssetAtPath<Texture2D>(iconPath);
        if (iconTexture != null)
        {
            PlayerSettings.SetIconsForTargetGroup(BuildTargetGroup.Standalone, new[] { iconTexture });
        }

        //// 设置自定义启动画面
        //public static void SetCustomSplashScreen()
        //{
        //    // 关闭 Unity Logo
        //    PlayerSettings.SplashScreen.showUnityLogo = false;

        //    // 设置自定义启动画面图片
        //    string splashImagePath = "Assets/Icons/customLogo.png";
        //    Texture2D splashImageTexture = AssetDatabase.LoadAssetAtPath<Texture2D>(splashImagePath);

        //    if (splashImageTexture != null)
        //    {
        //        // 设置启动画面的背景颜色
        //        PlayerSettings.SplashScreen.backgroundColor = Color.black;

        //        // 清除现有的启动画面
        //        PlayerSettings.SplashScreen.images = new UnityEditor.PlayerSettings.SplashScreenLogo[0];

        //        // 添加自定义启动画面
        //        PlayerSettings.SplashScreen.images = new UnityEditor.PlayerSettings.SplashScreenLogo[]
        //        {
        //        UnityEditor.PlayerSettings.SplashScreenLogo.Create(1f, splashImageTexture)
        //        };
        //    }
        //    else
        //    {
        //        Debug.LogError("Splash screen image not found at path: " + splashImagePath);
        //    }
        //}

        // 关闭 Unity Splash Screen
        PlayerSettings.SplashScreen.showUnityLogo = false;
    }
}